#ifndef _NODE
#define _NODE

#include <iostream>
using namespace std;

template<class T>
class List_S;

template<class T>
class Node
{
public:
	Node(const T& data, Node<T>* nextnode = NULL)
		:data(data),next(nextnode)
	{}
	Node(Node<T>* nextnode = NULL)
		:data(data), next(nextnode)
	{}

	~Node() { cout << "--" << endl; }

	T Getdata() const { return data; }
	T& Setdata() { return data; }
	Node<T>* Getnext() const { return next; }

	void insertAfter(Node<T>* p);
	void deleteAfter();

	friend List_S<T>;
private:
	T data;
	Node<T>* next;

};

template<class T>
void Node<T>::insertAfter(Node<T>* p)
{
	p->next = next;
	next = p;
}

template<class T>
void Node<T>::deleteAfter()
{
	if (next == NULL) return;
	next = next->next;
}

#endif